﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

using LowLevelGraphics.Filter;

namespace LowLevelGraphics.Extensions
{
    /// <summary>
    /// Some unsafebitmap extension
    /// </summary>
    public static class UnsafeBitmapExtensions
    {
        /// <summary>
        /// This gets all the pixels of an image
        /// </summary>
        /// <param name="image">The image.</param>
        /// <param name="rect">The rect.</param>
        /// <returns></returns>
        public static IEnumerable<Pixel> GetPixels(this UnsafeBitmap image, Rectangle rect)
        {
            return from y in rect.Top.To(rect.Bottom)
                   from x in rect.Left.To(rect.Right)
                   select new Pixel(x, y);
        }
    }
}
